package com.lawcheukwing.MagicDroidMouse;

import java.util.Timer;
import java.util.TimerTask;

import android.app.Activity;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.RectF;
import android.os.Bundle;
import android.view.SurfaceHolder;
import android.view.SurfaceHolder.Callback;
import android.view.SurfaceView;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ViewFlipper;

public class MouseTutorialActivity extends Activity {
	private static final String TAG = "MagicMouse";
	private ViewFlipper viewFlipper1;
	private Button btnNext;
	private Button btnPrevious;
	private LinearLayout llPage0;
	private LinearLayout llPage1;
	private MoveTutorialAnimationSurfaceView surfaceView0;
	private ClickAndScrollTutorialAnimationSurfaceView surfaceView1;
	
	public MouseTutorialActivity(){
		super();
	}
	
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		Object lastDisplayedChild = getLastNonConfigurationInstance();

		this.setTitle(R.string.txt_tutorial);
		this.setContentView(R.layout.tutorial_layout);
		
		viewFlipper1 = ((ViewFlipper) findViewById(R.id.viewFlipper1));
		btnNext = ((Button) findViewById(R.id.btnNext));
		btnPrevious = ((Button) findViewById(R.id.btnPrevious));
		llPage0 = ((LinearLayout) findViewById(R.id.llPage0));
		llPage1 = ((LinearLayout) findViewById(R.id.llPage1));
		
		surfaceView0 = new MoveTutorialAnimationSurfaceView(this);
		surfaceView1 = new ClickAndScrollTutorialAnimationSurfaceView(this);
		
		btnNext.setOnClickListener(new OnClickListener(){
			@Override
			public void onClick(View arg0) {
				int tmp = viewFlipper1.getDisplayedChild();
				viewFlipper1.showNext();
				setNavButtonEnabled();
				workaroundAndroidSurfaceViewBug(tmp);
			}
		});
		btnPrevious.setOnClickListener(new OnClickListener(){
			@Override
			public void onClick(View arg0) {
				int tmp = viewFlipper1.getDisplayedChild();
				viewFlipper1.showPrevious();
				setNavButtonEnabled();
				workaroundAndroidSurfaceViewBug(tmp);
			}
		});
		
		if(lastDisplayedChild != null){
			viewFlipper1.setDisplayedChild(((Integer) lastDisplayedChild).intValue());
		}
		
		setNavButtonEnabled();
		workaroundAndroidSurfaceViewBug(-1);
	}
	
	private void setNavButtonEnabled(){
		btnNext.setEnabled(viewFlipper1.getDisplayedChild() != viewFlipper1.getChildCount() - 1);
		btnPrevious.setEnabled(viewFlipper1.getDisplayedChild() != 0);
	}
	
	private void workaroundAndroidSurfaceViewBug(int previouslyDisplayedChild){
		switch(previouslyDisplayedChild){
		case 2:
			surfaceView0.stopAnimation();
			llPage0.removeView(surfaceView0);
			break;
		case 3:
			surfaceView1.stopAnimation();
			llPage1.removeView(surfaceView1);
			break;
		}
		
		switch(viewFlipper1.getDisplayedChild()){
		case 2:
			llPage0.addView(surfaceView0, 0);
			break;
		case 3:
			llPage1.addView(surfaceView1, 0);
			break;
		}
	}
	
	@Override
	public Object onRetainNonConfigurationInstance(){
		return new Integer(((ViewFlipper) findViewById(R.id.viewFlipper1)).getDisplayedChild());
	}
	
	private class MoveTutorialAnimationSurfaceView extends SurfaceView implements Callback {
		private SurfaceHolder holder;
		private Timer timer;
		private long startRenderTime;
		private final Path phoneShape = new PhoneShapePath();
		private final Paint greenLinePaint = new GreenLinePaint();
		private final Path tickShapePath = new TickShapePath();
		private boolean surfaceCreated = false;
		

		public MoveTutorialAnimationSurfaceView(Context context) {
			super(context);
			holder = this.getHolder();
			holder.addCallback(this);
		}
		
		private void startAnimation(){
			if(timer == null){
				timer = new Timer();
			}
			timer.scheduleAtFixedRate(new TimerTask(){
				@Override
				public void run() {
					draw();
				}
			}, 0, Math.round(1000 / 60)); //60 FPS
			startRenderTime = android.os.SystemClock.uptimeMillis();
		}
		
		private void stopAnimation(){
			if(timer != null){
				timer.cancel();
				timer.purge();
				timer = null;
			}
		}
		
		private synchronized void draw(){
			Canvas canvas = holder.lockCanvas();
			if(canvas == null) return;
			int w = canvas.getWidth();
			int h = canvas.getHeight();
			canvas.scale(w, h); //We use relative address to draw on this canvas.
			canvas.drawARGB(255, 0, 0, 0);
			long now = android.os.SystemClock.uptimeMillis();
			long progress = (now - startRenderTime) % 10000; //The last number is the period of the animation.
			if(progress < 1000){ //Fade in
				Paint paint = new GreenLinePaint();
				paint.setAlpha(Math.min(255, Math.round(progress * 255f / 500f))); // 500: fade in duration
				canvas.save();
				canvas.translate(0.18f, 0.2525f);
				canvas.drawPath(phoneShape, paint);
				canvas.restore();
			}else if(progress < 2000){ //Moving to (0.74, 0.2525)
				canvas.save();
				canvas.translate(0.18f + (0.74f - 0.18f) * (progress - 1000f) / 1000f, 0.2525f);
				canvas.drawPath(phoneShape, greenLinePaint);
				canvas.restore();
			}else if(progress < 3000){ //Moving to (0.625, 0.615)
				canvas.save();
				canvas.translate(0.74f + (0.625f - 0.74f) * (progress - 2000f) / 1000f, 0.2525f + (0.615f - 0.2525f) * (progress - 2000f) / 1000f);
				canvas.drawPath(phoneShape, greenLinePaint);
				canvas.restore();
			}else if(progress < 4000){ //Moving to (0.25, 0.3975)
				canvas.save();
				canvas.translate(0.625f + (0.25f - 0.625f) * (progress - 3000f) / 1000f, 0.615f + (0.3975f - 0.615f) * (progress - 3000f) / 1000f);
				canvas.drawPath(phoneShape, greenLinePaint);
				canvas.restore();
			}else if(progress < 5000){ //Draw a tick
				canvas.save();
				canvas.translate(0.25f, 0.3975f);
				canvas.drawPath(phoneShape, greenLinePaint);
				canvas.restore();
				canvas.save();
				RectF rect = new RectF();
				rect.top = 0f;
				rect.bottom = 1f;
				rect.left = 0.5f;
				rect.right = Math.min(1f, 0.5f + 0.5f * (progress - 4000f) / 500f);
				canvas.clipRect(rect);
				canvas.drawPath(tickShapePath, greenLinePaint);
				canvas.restore();
			}else if(progress < 6000){ //Fade in
				Paint paint = new GreenLinePaint();
				paint.setAlpha(Math.min(255, Math.round((progress - 5000f) * 255f / 500f))); // 500: fade in duration
				canvas.save();
				canvas.translate(0.18f, 0.2525f);
				canvas.drawPath(phoneShape, paint);
				canvas.restore();
			}else if(progress < 7000){ //Moving to (0.74, 0.2525), rotate to 45deg
				canvas.save();
				canvas.translate(0.18f + (0.74f - 0.18f) * (progress - 6000f) / 1000f, 0.2525f);
				canvas.rotate((progress - 6000f) * 45f / 1000f);
				canvas.drawPath(phoneShape, greenLinePaint);
				canvas.restore();
			}else if(progress < 8000){ //Moving to (0.625, 0.615), rotate to -180deg
				canvas.save();
				canvas.translate(0.74f + (0.625f - 0.74f) * (progress - 7000f) / 1000f, 0.2525f + (0.615f - 0.2525f) * (progress - 7000f) / 1000f);
				canvas.rotate(45f + (progress - 7000f) * -225f / 1000f);
				canvas.drawPath(phoneShape, greenLinePaint);
				canvas.restore();
			}else if(progress < 9000){ //Moving to (0.25, 0.3975), rotate to 90deg
				canvas.save();
				canvas.translate(0.625f + (0.25f - 0.625f) * (progress - 8000f) / 1000f, 0.615f + (0.3975f - 0.615f) * (progress - 8000f) / 1000f);
				canvas.rotate(180f + (progress - 8000f) * 270f / 1000f);
				canvas.drawPath(phoneShape, greenLinePaint);
				canvas.restore();
			}else{ //Draw the cross
				canvas.save();
				canvas.translate(0.25f, 0.3975f);
				canvas.rotate(90f);
				canvas.drawPath(phoneShape, greenLinePaint);
				canvas.restore();
				canvas.save();
				RectF rect = new RectF();
				rect.top = 0f;
				rect.bottom = 1f;
				rect.left = 0.5f;
				rect.right = Math.min(1f, 0.5f + 0.5f * (progress - 9000f) / 250f);
				Paint redPaint = new GreenLinePaint();
				redPaint.setARGB(255, 255, 0, 0);
				canvas.clipRect(rect);
				canvas.drawLine(0.61f, 0.585f, 0.86f, 0.86f, redPaint);
				canvas.restore();
				if(progress >= 9250){
					canvas.save();
					rect.left = Math.max(0.5f, 1f - 0.5f * (progress - 9250f) / 250f);
					canvas.clipRect(rect);
					canvas.drawLine(0.8675f, 0.5875f, 0.62f, 0.86f, redPaint);
					canvas.restore();
				}
			}
			holder.unlockCanvasAndPost(canvas);
		}
		
		@Override
		protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
		
		    int width = MeasureSpec.getSize(widthMeasureSpec);
		    int height = MeasureSpec.getSize(heightMeasureSpec);
		
		    width = Math.min(width, height);
		    height = Math.min(width, height);
		
		    super.onMeasure(
		            MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY),
		            MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY)
		    );
		}
		
		@Override
		protected void onVisibilityChanged(View changedView, int visibility){
			if(this.getVisibility() == VISIBLE && surfaceCreated){
				startAnimation();
			}else{
				stopAnimation();
			}
		}

		@Override
		public void surfaceChanged(SurfaceHolder holder, int format, int width,
				int height) {
			// TODO Auto-generated method stub
			
		}

		@Override
		public void surfaceCreated(SurfaceHolder holder) {
			surfaceCreated = true;
			if(getVisibility() == VISIBLE) startAnimation();
		}

		@Override
		public void surfaceDestroyed(SurfaceHolder holder) {
			surfaceCreated = false;
			stopAnimation();
		}
		
		//Classes
		
		private class GreenLinePaint extends Paint {
			public GreenLinePaint(){
				super();
				this.setARGB(255, 0, 255, 0);
				this.setStrokeWidth(0.01f);
				this.setStyle(Paint.Style.STROKE);
				this.setStrokeCap(Paint.Cap.BUTT);
				this.setStrokeJoin(Paint.Join.MITER);
				this.setAntiAlias(true);
			}
		}
		
		private class PhoneShapePath extends Path {
			public PhoneShapePath(){
				super();
				//Outer rectangle
				this.moveTo(-0.10880703f, -0.16257f); //I drew the shape in Inkscape and translate the XML to drawing code by hand.
				this.rLineTo(0.21762703f, 0f);
				this.rLineTo(0f, 0.325127f);
				this.rLineTo(-0.21762703f, 0f);
				this.close();
				//Inner rectangle
				this.moveTo(-0.084993553f, -0.111257f);
				this.rLineTo(0.17f, 0f);
				this.rLineTo(0f, 0.2075f);
				this.rLineTo(-0.17f, 0f);
				this.close();
				//Single line on the top
				this.moveTo(-0.03124353f, -0.136257f);
				this.rLineTo(0.062500001f, 0f);
				//Four lines on the bottom
				this.moveTo(-0.08358728f, 0.128118f);
				this.rLineTo(0.025f, 0f);
				this.moveTo(-0.03619144f, 0.128118f);
				this.rLineTo(0.025f, 0f);
				this.moveTo(0.012044f, 0.128118f);
				this.rLineTo(0.025f, 0f);
				this.moveTo(0.05860024f, 0.128118f);
				this.rLineTo(0.025f, 0f);
			}
		}
		
		private class TickShapePath extends Path {
			public TickShapePath(){
				super();
				this.moveTo(0.55f, 0.725f);
				this.lineTo(0.685f, 0.8975f);
				this.lineTo(0.9025f, 0.5475f);
			}
		}
		
		
		
	}

	private class ClickAndScrollTutorialAnimationSurfaceView extends SurfaceView implements Callback {
		private SurfaceHolder holder;
		private Timer timer;
		private long startRenderTime;
		private final Path phoneShape3D = new PhoneShape3DPath();
		private final Paint greenLinePaint = new GreenLinePaint();
		private final Paint redLinePaint = new RedLinePaint();
		private final Paint greenTextPaint = new GreenTextPaint();
		private final Path oneFingerHandShapePath = new OneFingerHandShapePath();
		private final Path twoFingerHandShapePath = new TwoFingerHandShapePath();
		private final Path threeFingerHandShapePath = new ThreeFingerHandShapePath();
		private boolean surfaceCreated = false;
		

		public ClickAndScrollTutorialAnimationSurfaceView(Context context) {
			super(context);
			holder = this.getHolder();
			holder.addCallback(this);
		}
		
		private void startAnimation(){
			if(timer == null){
				timer = new Timer();
			}
			timer.scheduleAtFixedRate(new TimerTask(){
				@Override
				public void run() {
					draw();
				}
			}, 0, Math.round(1000 / 60)); //60 FPS
			startRenderTime = android.os.SystemClock.uptimeMillis();
		}
		
		private void stopAnimation(){
			if(timer != null){
				timer.cancel();
				timer.purge();
				timer = null;
			}
		}
		
		private void drawHand(Canvas canvas, Path path,
				float startX, float startY, float startDeg,
				float endX, float endY, float endDeg,
				long startTime, long currentTime, long duration){
			canvas.translate(startX + (endX - startX) * (currentTime - startTime) / duration, startY + (endY - startY) * (currentTime - startTime) / duration);
			canvas.rotate(startDeg + (endDeg - startDeg) * (currentTime - startTime) / duration);
			canvas.scale(3f, 3f);
			canvas.save();
			canvas.clipPath(path);
			canvas.drawARGB(255, 0, 0, 0);
			canvas.drawPath(path, redLinePaint);
			canvas.restore();
		}
		
		private void drawHand(Canvas canvas, Path path,
				float X, float Y, float Deg){
			canvas.translate(X, Y);
			canvas.rotate(Deg);
			canvas.scale(3f, 3f);
			canvas.save();
			canvas.clipPath(path);
			canvas.drawARGB(255, 0, 0, 0);
			canvas.drawPath(path, redLinePaint);
			canvas.restore();
		}
		
		private void draw(){
			Canvas canvas = holder.lockCanvas();
			if(canvas == null) return;
			int w = canvas.getWidth();
			int h = canvas.getHeight();
			canvas.scale(w, h); //We use relative address to draw on this canvas.
			canvas.drawARGB(255, 0, 0, 0);
			long now = android.os.SystemClock.uptimeMillis();
			long progress = (now - startRenderTime) % 10000; //The last number is the period of the animation.
			canvas.save();
			canvas.translate(0.5f, 0.615f);
			canvas.scale(2f, 2f	);
			canvas.drawPath(phoneShape3D, greenLinePaint);
			canvas.restore();
			
			if(progress < 2500){
				canvas.save();
				canvas.drawText("Left Mouse Click", 0f, 0.1f, greenTextPaint);
				if(progress < 1000){ //Move in
					drawHand(canvas, oneFingerHandShapePath, 1.4f, 0.5f, 0f, 0.295f, 0.4f, -36f, 0, progress, 1000);
				}else if(progress < 1200){ //Idle
					drawHand(canvas, oneFingerHandShapePath, 0.295f, 0.4f, -36f);
				}else if(progress < 1400){ //Move down
					drawHand(canvas, oneFingerHandShapePath, 0.295f, 0.4f, -36f, 0.295f, 0.525f, -45f, 1200, progress, 200);
				}else if(progress < 1500){ //Holding
					drawHand(canvas, oneFingerHandShapePath, 0.295f, 0.525f, -45f);
				}else if(progress < 1700){ //Move up
					drawHand(canvas, oneFingerHandShapePath, 0.295f, 0.525f, -45f, 0.295f, 0.4f, -36f, 1500, progress, 200);
				}else if(progress < 2500){ //Idle
					drawHand(canvas, oneFingerHandShapePath, 0.295f, 0.4f, -36f);
				}
				canvas.restore();
			}else if(progress < 5000){
				canvas.save();
				canvas.drawText("Right Mouse Click", 0f, 0.1f, greenTextPaint);
				if(progress < 3000){ //Go to right button
					drawHand(canvas, oneFingerHandShapePath, 0.295f, 0.4f, -36f, 0.4475f, 0.3f, -36f, 2500, progress, 500);
				}else if(progress < 3200){ //Idle
					drawHand(canvas, oneFingerHandShapePath, 0.4475f, 0.3f, -36f);
				}else if(progress < 3400){ //Press
					drawHand(canvas, oneFingerHandShapePath, 0.4475f, 0.3f, -36f, 0.4475f, 0.4275f, -45f, 3200, progress, 200);
				}else if(progress < 3500){ //Hold
					drawHand(canvas, oneFingerHandShapePath, 0.4475f, 0.4275f, -45f);
				}else if(progress < 3700){ //Release
					drawHand(canvas, oneFingerHandShapePath, 0.4475f, 0.4275f, -45f, 0.4475f, 0.3f, -36f, 3500, progress, 200);
				}else if(progress < 4000){ //Idle
					drawHand(canvas, oneFingerHandShapePath, 0.4475f, 0.3f, -36f);
				}else if(progress < 5000){ //Get out
					drawHand(canvas, oneFingerHandShapePath, 0.4475f, 0.3f, -36f, 1.4f, 0.5f, 0f, 4000, progress, 1000);
				}
				canvas.restore();
			}else if(progress < 7500){
				canvas.save();
				canvas.drawText("Scroll", 0f, 0.1f, greenTextPaint);
				if(progress < 5750){ //Move in
					drawHand(canvas, twoFingerHandShapePath, 1.4f, 0.5f, 0f, 0.3325f, 0.3675f, -25f, 5000, progress, 750);
				}else if(progress < 5900){ //Idle
					drawHand(canvas, twoFingerHandShapePath, 0.3525f, 0.3675f, -25f);
				}else if(progress < 6000){ //Push down
					drawHand(canvas, twoFingerHandShapePath, 0.3525f, 0.3675f, -25f, 0.3525f, 0.4675f, -36f, 5900, progress, 100);
				}else if(progress < 6800){ //Scroll
					drawHand(canvas, twoFingerHandShapePath, 0.3525f, 0.4675f, -36f, 0.4625f, 0.56f, -36f, 0, 200 - Math.abs(((progress - 6000) % 400) - 200), 200);
				}else if(progress < 6900){ //Lift the fingers
					drawHand(canvas, twoFingerHandShapePath, 0.3525f, 0.4675f, -36f, 0.3525f, 0.3675f, -25f, 6800, progress, 100);
				}else if(progress < 7000){ //Idle
					drawHand(canvas, twoFingerHandShapePath, 0.3525f, 0.3675f, -25f);
				}else if(progress < 7500){
					drawHand(canvas, twoFingerHandShapePath, 0.3325f, 0.3675f, -25f, 1.4f, 0.5f, 0f, 7000, progress, 500);
				}
				canvas.restore();
			}else if(progress < 10000){
				canvas.save();
				canvas.drawText("Middle Mouse Click", 0f, 0.1f, greenTextPaint);
				if(progress < 8300){ //Move in
					drawHand(canvas, threeFingerHandShapePath, 1.4f, 0.5f, 0f, 0.365f, 0.3f, -25f, 7500, progress, 800);
				}else if(progress < 8500){ //Idle
					drawHand(canvas, threeFingerHandShapePath, 0.365f, 0.3f, -25f);
				}else if(progress < 8700){ //Touch
					drawHand(canvas, threeFingerHandShapePath, 0.365f, 0.3f, -25f, 0.365f, 0.48f, -45f, 8500, progress, 200);
				}else if(progress < 8800){ //Hold
					drawHand(canvas, threeFingerHandShapePath, 0.365f, 0.48f, -45f);
				}else if(progress < 9000){ //Lift
					drawHand(canvas, threeFingerHandShapePath, 0.365f, 0.48f, -45f, 0.365f, 0.3f, -25f, 8800, progress, 200);
				}else if(progress < 9200){ //Idle
					drawHand(canvas, threeFingerHandShapePath, 0.365f, 0.3f, -25f);
				}else if(progress < 10000){ //Go away
					drawHand(canvas, threeFingerHandShapePath, 0.365f, 0.3f, -25f, 1.4f, 0.5f, 0f, 9200, progress, 800);
				}
				canvas.restore();
			}
			holder.unlockCanvasAndPost(canvas);
		}
		
		@Override
		protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
		
		    int width = MeasureSpec.getSize(widthMeasureSpec);
		    int height = MeasureSpec.getSize(heightMeasureSpec);
		
		    width = Math.min(width, height);
		    height = Math.min(width, height);
		
		    super.onMeasure(
		            MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY),
		            MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY)
		    );
		}
		
		@Override
		protected void onVisibilityChanged(View changedView, int visibility){
			if(visibility == VISIBLE && surfaceCreated){
				startAnimation();
			}else{
				stopAnimation();
			}
		}

		@Override
		public void surfaceChanged(SurfaceHolder holder, int format, int width,
				int height) {
			// TODO Auto-generated method stub
			
		}

		@Override
		public void surfaceCreated(SurfaceHolder holder) {
			surfaceCreated = true;
			if(getVisibility() == VISIBLE) startAnimation();
		}

		@Override
		public void surfaceDestroyed(SurfaceHolder holder) {
			surfaceCreated = false;
			stopAnimation();
		}
		
		//Classes
		
		private class GreenLinePaint extends Paint {
			public GreenLinePaint(){
				super();
				this.setARGB(255, 0, 255, 0);
				this.setStrokeWidth(0.01f);
				this.setStyle(Paint.Style.STROKE);
				this.setStrokeCap(Paint.Cap.BUTT);
				this.setStrokeJoin(Paint.Join.MITER);
				this.setStrokeMiter(0.04f);
				this.setAntiAlias(true);
			}
		}
		
		private class GreenTextPaint extends Paint {
			public GreenTextPaint(){
				super();
				this.setARGB(255, 0, 255, 0);
				this.setStyle(Paint.Style.FILL);
				this.setTextSize(0.1f);
				this.setTextAlign(Paint.Align.LEFT);
				this.setAntiAlias(true);
			}
		}
		
		private class RedLinePaint extends GreenLinePaint {
			public RedLinePaint(){
				super();
				this.setARGB(255, 255, 0, 0);
			}
		}
				
		private class PhoneShape3DPath extends Path {
			public PhoneShape3DPath(){
				super();
				//3D box shape
				this.moveTo(0.23559f, 0.07990702f);
				this.lineTo(0.04168411f, 0.17871f);
				this.lineTo(-0.23558611f, -0.04491033f);
				this.rLineTo(0f, -0.035006499f);
				this.lineTo(-0.041680219f, -0.17871981f);
				this.lineTo(0.23559f, 0.044900519f);
				this.close();
				this.moveTo(-0.23544446f, -0.07988464f);
				this.lineTo(0.041684109f, 0.1437035f);
				this.lineTo(0.2353125f, 0.045078122f);
				//Screen
				this.moveTo(-0.17060825f, -0.05435419f);
				this.lineTo(-0.019138089f, -0.13261566f);
				this.lineTo(0.15781913f, 0.010101549f);
				this.lineTo(0.00634897f, 0.087281791f);
				this.close();
				//Speaker
				this.moveTo(-0.14403708f, -0.09703285f);
				this.rLineTo(0.055687564f, -0.02837509f);
				//Four buttons
				this.moveTo(0.034785148f, 0.10856677f);
				this.lineTo(0.057060172f, 0.097216732f);
				this.moveTo(0.077014887f, 0.087048989f);
				this.lineTo(0.099289911f, 0.075698953f);
				this.moveTo(0.11924463f, 0.06553121f);
				this.lineTo(0.14151965f, 0.054181174f);
				this.moveTo(0.16147437f, 0.044013431f);
				this.lineTo(0.18374939f, 0.032663396f);
			}
		}
		
		private class OneFingerHandShapePath extends Path {
			public OneFingerHandShapePath(){
				super();
				this.moveTo(0.05204843f, 0.20888156f);
				this.rLineTo(-0.06275572f, 0.00176777f);
				this.rCubicTo(-0.01246832f, -0.03442366f, -0.02213209f, -0.04700256f, -0.02474874f, -0.0723651f);
				this.rCubicTo(0.000743f, -0.02549153f, -0.0221066f, -0.04772206f, -0.01414212f, -0.05745242f);
				this.rCubicTo(0.01198408f, -0.00982888f, 0.03522635f, 0.04052616f, 0.03910543f, 0.05438262f);
				this.rCubicTo(0.0047140496f, -0.03623922f, -0.00576701f, -0.1360515402f, 0.0101921396f, -0.1374676702f);
				this.rCubicTo(0.0135161004f, 0.001594f, 0.00648181f, 0.0707106802f, 0.00972271f, 0.1060660202f);
				this.cubicTo(0.01312837f, 0.0879052f, 0.0029136196f, 0.05680453f, 0.02022865f, 0.05552778f);
				this.cubicTo(0.03328086f, 0.05286558f, 0.02745993f, 0.08586861f, 0.03083525f, 0.10148972f);
				this.cubicTo(0.03407616f, 0.09029386f, 0.0264969f, 0.06557005f, 0.04055797f, 0.06790215f);
				this.cubicTo(0.05262394f, 0.06855115f, 0.04645052f, 0.09265088f, 0.0493968f, 0.10502525f);
				this.cubicTo(0.05201684f, 0.09641092f, 0.0486205f, 0.07672099f, 0.0600034f, 0.0758571f);
				this.cubicTo(0.07292109f, 0.07474283f, 0.06995938f, 0.19616963f, 0.0684003f, 0.12579652f);
				this.close();
			}
		}
		
		private class TwoFingerHandShapePath extends Path {
			public TwoFingerHandShapePath(){
				super();
				this.moveTo(0.05204843f, 0.20888156f);
				this.rLineTo(-0.06275572f, 0.00176777f);
				this.rCubicTo(-0.01246832f, -0.03442366f, -0.02213209f, -0.04700256f, -0.02474874f, -0.07203651f);
				this.rCubicTo(0.000743f, -0.02549153f, -0.0058566f, -0.02709706f, 0.00210788f, -0.03682742f);
				this.rCubicTo(0.01198408f, -0.00982888f, 0.01897635f, 0.01990116f, 0.02285534f, 0.03375762f);
				this.cubicTo(-0.0057787604f, 0.0993038f, -0.04063482f, -0.0005085202f, -0.02447567f, -0.0019246502f);
				this.cubicTo(-0.01095957f, -0.0003306502f, 0.0063811396f, 0.06878603f, 0.0096220396f, 0.10414137f);
				this.cubicTo(0.01312837f, 0.0879052f, 0.01416362f, -0.0075704701f, 0.03147865f, -0.0088472201f);
				this.cubicTo(0.04453086f, -0.01150942f, 0.02745993f, 0.08586861f, 0.03083525f, 0.10148972f);
				this.cubicTo(0.03407616f, 0.09029386f, 0.02649469f, 0.06557005f, 0.04055797f, 0.06790215f);
				this.cubicTo(0.05262394f, 0.06855115f, 0.04645052f, 0.09265088f, 0.0493968f, 0.10502525f);
				this.cubicTo(0.05201684f, 0.09641092f, 0.0486205f, 0.07672099f, 0.0600034f, 0.0758571f);
				this.cubicTo(0.07292109f, 0.07474283f, 0.06995938f, 0.10616963f, 0.0684003f, 0.12579652f);
				this.close();
			}
		}
		
		private class ThreeFingerHandShapePath extends Path {
			public ThreeFingerHandShapePath(){
				super();
				this.moveTo(0.05204843f, 0.20888156f);
				this.rLineTo(-0.06275572f, 0.00176777f);
				this.rCubicTo(-0.01246832f, -0.03442366f, -0.02213209f, -0.04700256f, -0.02474874f, -0.07203651f);
				this.rCubicTo(0.000743f, -0.02549153f, -0.0058566f, -0.02709706f, 0.00210788f, -0.03682742f);
				this.rCubicTo(0.01198408f, -0.00982888f, 0.01897635f, 0.01990116f, 0.02285534f, 0.03375762f);
				this.cubicTo(-0.0057787604f, 0.0993038f, -0.04063482f, -0.0005085202f, -0.02447567f, -0.0019246502f);
				this.cubicTo(-0.01095957f, -0.0003306502f, 0.0063811396f, 0.06878603f, 0.0096220396f, 0.10414137f);
				this.cubicTo(0.01312837f, 0.0879052f, -0.00833638f, -0.0088204701f, 0.00897865f, -0.01009722f);
				this.cubicTo(0.02203086f, -0.01275942f, 0.02745993f, 0.08586861f, 0.03083525f, 0.10148972f);
				this.cubicTo(0.03407616f, 0.09029386f, 0.02649469f, -0.01067995f, 0.04055797f, -0.00834785f);
				this.cubicTo(0.05262394f, -0.00769885f, 0.04645052f, 0.09265088f, 0.0493968f, 0.10502525f);
				this.cubicTo(0.05201684f, 0.09641092f, 0.0486205f, 0.07672099f, 0.0600034f, 0.0758571f);
				this.cubicTo(0.07292109f, 0.07474283f, 0.06995938f, 0.10616963f, 0.0684003f, 0.12579652f);
				this.close();
			}
		}
		
		
		
	}

}
